require(['./config'],() => {
    require(['template','request','header','footer','info','jquery'],(template,req) =>{
        class List{
            constructor(){
                this.init();
            }
            //定义一个地址栏的id发送请求
            init(){
                // console.log(window);
                var id = window.location.search.split('=')[1];
                // console.log(id);
                //发送请求
                req.getListData(id)
                    .then(res => {
                        // console.log(res)
                        if(res.code === 200){
                            //渲染页面
                            this.render(res.data.items);
                        }
                    })
            }
            render(res){
                console.log(res)
                //选拔list数据解构出来
                var { list } = res
                console.log(list);
                $('section .right ul').html(template('listTemplate',{list}))
            }

        }
        return new List();
    })
})